<?php

include('includes.php');
$user = $_SESSION['user'];

if (isset($user))
{
    echo $user->getId();

    $q = usuariosQuery::create()->findPk($user->getId());

    if (isset($q))
    {
        if ($q->getAdmin() == true)
        {
            $categoria = new categoria();
            $categoria->setNombre($_POST['nombre']);
            $categoria->setPosicion($_POST['posicion']);
            $categoria->save();
        }
    }
}
$host3 = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'categorias.php';
header("Location: http://" . $host3 . $uri . "/" . $extra);
die();
?>
